import './mock.js'
import axios from 'axios';
axios.defaults.baseURL = 'http://29b75691w8.qicp.vip'
axios.interceptors.request.use(function (config) {
  return config
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error)
})

var api = {
  test(params) {
    return axios.get('/user_list', params)
  },
  searchHotWords() {
    return axios.get('/api/meituan/mock/header/searchHotWords.json')
  },
  getSearchList() {
    return axios.get('/api/meituan/mock/header/search.json')
  },
  getMenuList() {
    return axios.get('/api/meituan/mock/index/nav.json')
  },
  resultsByKeywords() {
    return axios.get('/api/meituan/mock/index/resultsByKeywords.json')
  },
  getProductsList() {
    return axios.get('/api/meituan/mock/list/goodsList.json')
  },
  getHotCity() {
    return axios.get('/api/meituan/mock/city/hot.json')
  },
  getRecentCity() {
    return axios.get('/api/meituan/mock/city/recents.json')
  },
  getProvinceList() {
    return axios.get('/api/meituan/mock/city/province.json')
  },
  getCurPosition() {
    return axios.get('/api/meituan/mock/city/getPosition.json')
  },
  getCityList() {
    return axios.get('/api/meituan/mock/city/cityList.json')
  },
  login(params) {
    return axios.get('/api/meituan/login', params)
  },
  register(params) {
    return axios.get('/api/meituan/register', params)
  }
}

export default api